/*
 * 
 * LegendShop 多用户商城系统
 * 
 *  版权所有,并保留所有权利。
 * 
 */
package com.legendshop.oa.service.impl;

import com.legendshop.dao.support.PageSupport;
import com.legendshop.oa.constants.EventOperationTypeEnum;
import com.legendshop.oa.constants.EventTypeEnum;
import com.legendshop.oa.dao.EventDao;
import com.legendshop.oa.dto.EventQueryDto;
import com.legendshop.oa.model.UserEvent;
import com.legendshop.oa.security.UserDetail;
import com.legendshop.oa.service.EventService;

/**
 * 事件实现类，所有的事件写在同一个表.
 */
public class EventServiceImpl implements EventService {
	
	private EventDao eventDao;

	public void setEventDao(EventDao eventDao) {
		this.eventDao = eventDao;
	}

	/**
	 * 获取Id事件
	 *
	 * @param id the id
	 * @return the event
	 */
	public UserEvent getEvent(Long id) {
		return eventDao.getEvent(id);
	}


	/**
	 * 保存事件
	 *
	 * @param userEvent the user event
	 * @return the long
	 */
	public Long saveEvent(UserEvent userEvent) {
		return eventDao.saveEvent(userEvent);
	}


	/**
	 * 查询事件
	 * @param curPageNO
	 * @param type
	 * @param relateId
	 * @param userName
	 * @return
	 */
	public PageSupport<UserEvent> getEventPage(EventQueryDto eventQueryDto){
		return eventDao.getEventPage(eventQueryDto);
	}

	@Override
	public Long saveEvent(UserDetail ud, Long relateId, String relateData, EventTypeEnum eventType,
			EventOperationTypeEnum eventOperationType) {
		return eventDao.saveEvent(ud, relateId, relateData, eventType, eventOperationType);
	}

	@Override
	public Long saveEvent(UserDetail ud, Long relateId, String title, String relateData, EventTypeEnum eventType,
			EventOperationTypeEnum eventOperationType) {
		return eventDao.saveEvent(ud, relateId, title, relateData, eventType, eventOperationType);
	}
}
